home *** CD-ROM | disk | FTP | other *** search
/ Back to Campus / Back to Campus - Computer Life (Ziff-Davis)(1995).ISO / shgmdemo / install / inst.mst < prev    next >
Text File  |  1995-05-01  |  47KB  |  1,389 lines

  1. '**************************************************************************
  2. '*  MS Test script for Win32s, WinG, and Shanghai Great Moments
  3. '**************************************************************************
  4.  
  5. ''$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. ''XXX
  8. ''$define   MYDEBUG '' define for script development'
  9.  
  10. '$INCLUDE 'setupapi.inc'
  11. '$INCLUDE 'msdetect.inc'
  12.  
  13. '*-------------------------------[ Constants ]------------------------------*'
  14. const MIN_DRIVE_SPACE           = 12000000  '' 12 megs
  15. const LOGO                      = 1         ''Bitmap ID
  16. const InfFile$                  = "shgm.inf"   '
  17. const ErrStr$                   = "**** ERROR ****: "
  18. const CUIDLL$                   = "mscuistf.dll"
  19.  
  20. const hlpOFFSET                 = 10    '' add to dialog ID to get help dlg ID
  21.  
  22. const verNOT_EXIST              = 0
  23. const verIS_OLDER               = 1
  24. const verINCOMPLETE             = 2
  25. const verSAME_BUT_MISSING       = 3
  26. const verSAME_AND_VALID         = 4
  27. const verIS_NEWER               = 5
  28.  
  29.  
  30. '*-------------------------------[ Dialog IDs ]-----------------------------*'
  31.  
  32. const dlgWELCOME                = 100   '' Welcome dialog box
  33. const hlpWELCOME                = 110   '' Help msgbox for welcome dialog
  34.  
  35. const dlgASKQUIT                = 200   '' Confirm quit install dialog
  36.  
  37. ''Finished! dialog boxes
  38. ''
  39. const EXITSUCCESS               = 700   '' Successful install msgbox
  40. const   dlgOK_NEED_W32S_WING    = 710   '' Install ok, but still need WinG/W32s
  41. const   dlgOK_NEED_W32S         = 720   '' Install ok, but still need W32s
  42. const   dlgOK_NEED_WING         = 730   '' Install ok, but still need WinG
  43.  
  44. '' Final dialog boxes
  45. ''
  46. const dlgRESTART_MUST           = 740
  47. const dlgRESTART_PLEASE         = 750
  48.  
  49. const dlgBADDISKSPACE           = 10000 '' insufficient space on disk
  50. const dlgBADDISKSPACEEXT        = 10010 '' insufficient space on disk for
  51.                                         '' extensions
  52. const dlgBADPATH                = 10100 '' bad path msgbox
  53. const dlgBADDRIVE               = 10110 '' bad drive msgbox
  54.  
  55. '' Status dialog boxes
  56. const dlgSCANW32S               = 300   '' Checking for Win32s files
  57. const dlgSCANWING               = 301   '' Checking for WinG files
  58. const dlgCHECKSPACE             = 350   '' Checking disk space
  59.  
  60.  
  61. '' Notify install/skip-install dialogs
  62. ''
  63. const dlgW32S                   = 5000
  64. const dlgWING                   = 5100
  65. const dlgSHGM                   = 5200  '' this one asks for destination path
  66.  
  67. const dlgNO_SHARE               = 1330  ''
  68. const hlpNO_SHARE               = 1010  '' Help msgbox for no-share warning
  69.  
  70. '' Confirmation dialog boxes
  71. ''
  72. const dlgCONFIRM_OVER_W32S      = 2000
  73. const dlgCONFIRM_OVER_WING      = 2010
  74.  
  75. const dlgCONFIRM_SKIP_W32S      = 2100
  76. const dlgCONFIRM_SKIP_WING      = 2110
  77.  
  78.  
  79. '' Install failure codes that also correspond to dialog msgbox id numbers
  80. ''
  81. const exitFAILURE               = 400   '' generic Failure msgbox
  82. const exitFAILW32S              = 410   '' Win32s install failure
  83. const exitFAILWING              = 420   '' WinG install failure
  84. const exitFAILSHGM              = 430   '' SHGM install failure
  85. const exitQUIT                  = 600   '' User quit install msgbox
  86.  
  87. '' System config errors that cause install failure
  88. ''
  89. const sysfailNOTWIN31           = 1200  ''
  90. const sysfailNOTENH             = 1300  '' Not enhanced mode Win3.1x failure
  91. const sysfailNOTPAGING          = 1325  '' No VM enabled failure
  92. const sysfailNOTINTEL           = 1350
  93. const sysFAILRUNAPP             = 1360  '' Win32s failure (Win32s active)
  94. const sysfailNT31               = 1365  '' version of NT was less than 3.5
  95. const sysfail256COLOR           = 1370  '' 256 color mode not detected
  96.  
  97. const verSKU$                   = "SKU" '' Main SKU
  98. const verPOP$                   = "POP" '' POP demo
  99. const verCVR$                   = "CVR" '' Cover demo
  100.  
  101. '*------------------------------[ Misc Globals ]----------------------------*'
  102. global driveWinSys$         '' Drive Windows is on
  103. global dirWinSys$           '' Windows\System directory.
  104. global dirWinSysWin32s$     '' Windows\System\Win32s directory
  105. global dirSHGM$             '' SHGM destination directory
  106. global SrcDir$              '' Source directory (where the .INF file is)
  107.  
  108. '' status flags
  109. global onWin31%             '' 0 = not 3.1x, 1 = on Win3.1x
  110. global win32Enabled%        '' 0 = not enabled, 1 = enabled
  111. global prevW32s%            '' set to one of the ver?????? constants
  112. global prevWinG%            '' set to one of the ver?????? constants
  113.  
  114. global szW32OldVer$
  115.  
  116. global boolLog%             '' 0 = logfile closed, 1 = logfile open
  117.  
  118. global instVers$
  119.  
  120. '*-------------------------------[ Prototypes ]-----------------------------*'
  121. declare sub InstallWin32sFiles
  122. declare sub InstallWinGFiles
  123. declare sub InstallSHGMFiles
  124.  
  125. declare function RebootSystem AS INTEGER
  126. declare function MakePath (szDir$, szFile$) AS STRING
  127.  
  128. declare sub dputs(arg1$)    '' print string to logfile or debug screen with '\n'
  129.  
  130. declare sub W32SAddToCopyList
  131. declare sub WINGAddToCopyList
  132. declare sub SHGMAddToCopyList
  133.  
  134. declare function InstallVFlatD as integer
  135.  
  136. declare function DoesSectionFilesExist(szSection$,szDirPath$,dlgID%) as integer
  137.  
  138. declare function Have256Colors as integer
  139.  
  140. declare function ConfirmDialog(dlgID%) as integer
  141.  
  142. '*-------------------------[ External DLL functions ]-----------------------*'
  143. '$ifdef MYDEBUG
  144. declare function OutputDebugString LIB "KRNL386.EXE" (arg1$) as integer
  145. '$endif
  146.  
  147. declare function OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  148. declare function PagingEnabled LIB "INIUPD.DLL" AS INTEGER
  149. declare function ShareEnabled LIB "INIUPD.DLL" AS INTEGER
  150. declare function IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER
  151. declare function IsRunningApp LIB "INIUPD.DLL" AS INTEGER
  152.  
  153. declare function SetCuiFlags LIB "MSCUISTF.DLL" (arg1%, arg2%) AS INTEGER
  154.  
  155. declare function ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
  156.  
  157. '' WinG stuff
  158. declare function VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  159. declare function RestartWindows LIB "setuphlp.DLL" AS INTEGER
  160. ''declare function OnWin3x LIB "setuphlp.DLL" AS INTEGER
  161. ''declare function GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
  162. ''declare function IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
  163. ''declare sub RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$)
  164.  
  165.  
  166. '' Custom stuff in UTILS.DLL to update SYSTEM.INI
  167. declare function UpdateIniW32S LIB "utils.dll" as integer
  168. declare function UpdateIniWING LIB "utils.dll" as integer
  169.  
  170. '*----------------------------[ Start of script ]---------------------------*'
  171. INIT:
  172.     HELPPROC$     = "FHelpDlgProc"      '' Help dialog procedure
  173.     szW32OldVer$  = "1.00.000     "     '' Reserve space in string for version
  174.  
  175.     '' bools
  176.     onWin31%      = 0
  177.     win32Enabled% = 0
  178.  
  179.     '' flags to indicate existence or previous versions
  180.     prevW32s%     = ver_NOT_EXIST
  181.     prevWinG%     = ver_NOT_EXIST
  182.  
  183.     okW32S%       = 0
  184.     okWING%       = 0
  185.     okSHGM%       = 0
  186.  
  187.     instW32S%     = 0
  188.     instWING%     = 0
  189.     instSHGM%     = 0
  190.  
  191.     doAddDVA%     = 0
  192.  
  193.     warnNeedW32S% = 0
  194.     warnNeedWING% = 0
  195.  
  196.     systemIniBackedUp% = 0
  197.  
  198.     ON ERROR goto ERRNORMAL
  199.  
  200.     '' Read in the .INF file
  201.     ''
  202.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  203.  
  204.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  205.     if szInf$ = "" then
  206.         szInf$ = GetSymbolValue("STF_CWDDIR") + InfFile$
  207.     endif
  208.     ReadInfFile szInf$
  209.  
  210.     '' Setup a pretty looking screen :)
  211.     ''
  212.     SetBitmap CUIDLL$, LOGO
  213.     SetTitle "Shanghai: Great Moments Setup"
  214.  
  215.     '' Determine install type
  216.     instVers$ = GetSymbolValue("VER_INSTALL")
  217.  
  218.     '' Determine install directories
  219.     ''
  220.     dirWinSys$ = GetWindowsSysDir()
  221.     dirWinSysWin32s$ = dirWinSys$ + "WIN32S\"
  222.     driveWinSys$ = MID$(GetWindowsDir, 1, 1)
  223.  
  224.     driveNeeds$ = "DriveNeeds"
  225.  
  226. '$IFDEF DEBUG
  227.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  228.     driveWinSys$ = MID$(GetWindowsDir, 1, 1)
  229.